package imagekeeper.data.mapping;

import java.util.ArrayList;
import java.sql.ResultSet;
import java.sql.SQLException;
import imagekeeper.dmi.ImageTag;


public class ImageTagMapper {
    public final static String TableName = "image_tag";
    public final static String ColumnId = "id";
    public final static String ColumnValue = "tag_value";
    
    public final static String SpSelectImageTags = "select_image_tags";
    public final static String SpCreateUpdateImageTag = "create_image_tag";
    public final static String SpRemoveImageTags = "remove_image_tag";
    
    public static ArrayList<ImageTag> getImageTags(ResultSet rs) throws SQLException {
        ArrayList<ImageTag> result = new ArrayList<ImageTag>();
        int tagId;
        String tagValue = null;
        while (rs.next()) {
            tagId = rs.getInt(ColumnId);
            tagValue = rs.getString(ColumnValue);
            result.add(new ImageTag(tagId, tagValue));
        }
        return result;
    }
}
